// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ValidatorDupBean4.java

package include.validator;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import javax.servlet.http.HttpSession;

public class ValidatorDupBean4
{

	private boolean a;

	public ValidatorDupBean4()
	{
	}

	public boolean isDup(HttpSession session, String tn, String fn, String value, String values, String valued)
	{
		try
		{
			String first_kind_ID = "";
			String first_kind_name = "";
			for (StringTokenizer tokenTO = new StringTokenizer(values, "/"); tokenTO.hasMoreTokens();)
			{
				first_kind_ID = tokenTO.nextToken();
				first_kind_name = tokenTO.nextToken();
			}

			String second_kind_ID = "";
			String second_kind_name = "";
			for (StringTokenizer tokenTO = new StringTokenizer(valued, "/"); tokenTO.hasMoreTokens();)
			{
				second_kind_ID = tokenTO.nextToken();
				second_kind_name = tokenTO.nextToken();
			}

			nseer_db db = new nseer_db((String)session.getAttribute("unit_db_name"));
			String sql = (new StringBuilder("select * from ")).append(tn).append(" where ").append(fn).append("='").append(value).append("' and first_kind_ID='").append(first_kind_ID).append("' and second_kind_ID='").append(second_kind_ID).append("' and third_kind_name!=''").toString();
			ResultSet rs = db.executeQuery(sql);
			if (rs.next())
				a = true;
			else
				a = false;
			db.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return a;
	}
}
